<?php
/**
 * Created by PhpStorm.
 * User: shkj
 * Date: 2020/4/15
 * Time: 10:45
 */

namespace app\api\controller\v1;


use app\api\model\Category as Cate;
use think\facade\Request;
class Category extends Base
{
  

    private $obj;
    public function __construct() {

        $this->obj = model("Category");
    }

    public function select(){
        $this->obj->select();
    }

    public function all(){
        $type = Request::param('type');
        $pagesize = Request::param('pagesize');
        $pagenum = Request::param('pagenum');        
        $this->obj->all($pagesize,$pagenum,$type);
    }

    public function recommended(){
      $res = $this->obj->recommend();
    }

    public function add(){
    	$data = Request::post();
        $this->obj->add($data);
    }

    public function delete(){
        $id = Request::param('id');
        $this->obj->del($id);
    }

    public function detail(){
        $id = Request::param('id');
        $this->obj->detail($id);
    }


    public function edit(){
        $id = Request::param('id');

        $data = Request::post();
        
        $this->obj->modify($id,$data);
    }


  

}